package com.roger.mybatisplus.demo.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.roger.mybatisplus.demo.entity.SysUser;

import com.roger.mybatisplus.demo.dao.SysUserMapper;
import com.roger.mybatisplus.demo.entity.SysUserQto;
import com.roger.mybatisplus.demo.entity.SysUserVo;
import com.roger.mybatisplus.demo.service.SysUserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SysUserServiceImpl implements SysUserService {
    @Resource
    private SysUserMapper sysUserMapper;

    @Override
    public Page<SysUser> findByPage(Integer current) {
        Page<SysUser> page = new Page<>(current, 3);
        List<SysUser> pageUsers = sysUserMapper.findPageUsers(page);
        page.setRecords(pageUsers);
        return page;
    }

    @Override
    public Page<SysUserVo> findPageByCondition(Integer current, Integer size, SysUserQto qto) {
        Page<SysUserVo> page = new Page<>(current, size);
        List<SysUserVo> pageUsers = sysUserMapper.findPageUsersByCondition(page,qto);
        page.setRecords(pageUsers);
        return page;
    }
}
